﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

/*
 * 脚本功能：Unity方法扩展
 * 编写日期：2018.12.13
 * 编写人：HYZ
 */
namespace CFrame.Tools
{
    public static class UnityExtended
    {

        /// <summary>
        /// 尝试根据Key得到value，得到直接返回value ,没有返回null
        /// </summary>
        /// <typeparam name="Tkey"></typeparam>
        /// <typeparam name="Tvalue"></typeparam>
        /// <param name="dict"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public static Tvalue TryGet<Tkey,Tvalue>(this Dictionary<Tkey,Tvalue> dict,Tkey key){
            Tvalue value;
            dict.TryGetValue(key, out value);
            return value;
        }
    }

    /// <summary>
    /// 网络消息接收委托
    /// </summary>
    /// <param name="actionCode"></param>
    /// <param name="data"></param>
    public delegate void NetCallback(int actionCode, string data);
}
